<template>
  <div>
    <table border="1" cellspacing="1">
      <tr>
        <td>文章</td>
        <td>操作</td>
      </tr>
      <tr v-for="i in wzlist" :key="i.id">
        <td>{{i.title}}</td>
        <td>
          <van-button @click="tg(i.id)">通过</van-button>
          <van-button @click="btg(i.id)">不通过</van-button>
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
import maxios from "@/http/axios";

export default {
  name: "jysp",
  data() {
    return {
      wzlist: []
    }
  },
  methods:{
    get_wzlist(){
      maxios('/book/get_wz','get').then(res=>{
        this.wzlist = res.list
      })
    },
    tg(id){
      maxios('/book/agreen?id='+id,'get').then(res=>{
        if(res.code==200){
          alert('ok')
          this.get_wzlist()
        }
        else {
          alert('no')
        }
      })
    },
    btg(id){
      maxios('/book/noagreen?id='+id,'get').then(res=>{
        if(res.code==200){
          alert('ok')
          this.get_wzlist()
        }
        else {
          alert('no')
        }
      })
    }
  },
  mounted() {
    this.get_wzlist()
  }
}
</script>

<style scoped>

</style>